class AddRoleToMembers < ActiveRecord::Migration
  def self.up
    add_column "members", :role, :string, :limit => 20, :default => 'guest'
    add_index "members", :role
    
    member = Member.new(:email => "admin@station-c.com",
                        :login => "admin",
                        :password => "admin",
                        :password_confirmation => "admin")
    member.membership = "resident"
    member.role = "admin"
    member.save!
  end

  def self.down
    remove_column "members", :role
    admin_member = Member.find_by_login('admin')
    admin_member.destroy if admin_member
  end
  
end